package com.angis.fx.db;

import android.content.ContentValues;
import android.content.Context;

public class DutyInfoDBHelper extends ObjectDBHelper {

	public static final String PK_DUTYNO = "dutyno";
	public static final String COLUMN_DUSERNAME = "dusername";
	public static final String COLUMN_STARTDUTYTIME = "startdutytime";
	public static final String COLUMN_ENDDUTYTIME = "enddutytime";
	public static final String COLUMN_DUTYSTATUS = "dutystatus";
	public static final String COLUMN_MCTJUUID = "mctjuuid";
	public static final String COLUMN_AFTJUUID = "aftjuuid";
	public static final String COLUMN_MCAREACODE = "mcareacode";
	public static final String COLUMN_AFAREACODE = "afareacode";
	public static final String COLUMN_SXRY = "sxry";
	public static final String COLUMN_TOGETHERUSER = "togetheruser";
	public static final String COLUMN_OTHERUSER = "otheruser";
	public static final String COLUMN_OTHERCOUNT = "othercount";
	public static final String COLUMN_CDRC = "cdrc";

	private static final String TABLE_DUTYINFO = "dutyinfo";

	public DutyInfoDBHelper(Context context) {
		super(context);
	}

	public long insertDutyInfo(ContentValues pValues) {
		return insert(TABLE_DUTYINFO, pValues);
	}
	
	public long updateDutyInfo(ContentValues pValues) {
		if(null == writeDB) {
			writeDB = dbHelper.getWritableDatabase();
		}
		return writeDB.update(TABLE_DUTYINFO, pValues, PK_DUTYNO + "=?", new String[]{(String) pValues.get(PK_DUTYNO)});
	}

	public boolean deleteDutyInfo(String pDusername) {
		String params[] = new String[] { pDusername };
		return writeDB.delete(TABLE_DUTYINFO, PK_DUTYNO + "=?", params) > 0;
	}

}
